package view;

import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JPanel;

import model.FieldGenerator;
import model.PV;

public class MainView extends JPanel {
	
	public MainView() {

		PV.setNodeNet(FieldGenerator.createEmpty());
		//PV.setNodeNet(FieldGenerator.createLogicMaze(30));
		setLayout(null);
		
		for (int i = 0; i < PV.getNodeNet().length; i++) {
			for (int j = 0; j < PV.getNodeNet()[i].length; j++) {
				
				add(PV.getNodeNet()[i][j]);
				//PV.getNodeNet()[i][j].setBackground(new Color((float)Math.random(),(float) Math.random(), (float)Math.random()));
				
			}
		}
		//setPreferredSize(new Dimension(PV.getFieldWidth()*PV.getNodeSize(),PV.getFieldHeight()*PV.getNodeSize()));
		setBackground(Color.DARK_GRAY);
		//setVisible(true);
		
		
	}
	
	@Override
	
	public void paint(Graphics g) {
		
		
		
		
		super.paint(g);
		for (int i = 0; i < PV.getNodeNet().length; i++) {
			for (int j = 0; j < PV.getNodeNet()[i].length; j++) {
				
				PV.getNodeNet()[i][j].repaint();
				
				
			}
		}
		
	}
}
